<template>
    <span>
        <Button type="error" size="small" @click="handleTaskDelete(data)">删除</Button>
    </span>
</template>

<script>
export default {
    name: "TaskDeleteButton",
    props: {
        data: Object
    },
    methods: {
        handleTaskDelete(row) {
            this.$Modal.confirm({
                title: '删除',
                content: '确定删除吗？',
                onOk: () => {
                    this.$http.post('/delete_task', { task_id: row.task_id }).then(res => {
                        this.$Message.success('删除成功');
                        this.$emit('success', res);
                    });
                },
                onCancel: () => {
                    this.$Message.info('取消删除');
                }
            });
        },
    }
}
</script>